<?php
namespace Home\Controller;
use Think\ControllerEx;
class UserController extends CommonController {
    
  public function _initialize(){
      $this->base_init('User');
  }
  
  public function changePs(){
    $this->display('change-password');
  }

  //
  public function uppass(){
    	$date['password'] = I('newpassword');
    	$pass2        = I('newpassword2');

    	$where['uid'] = session('home')['uid'];

    	if ($date['password'] == $pass2) {

    		$userRes = $this->dbTable->where($where)->setField($date);
    		if ($userRes !== false) {
    			$this->success('密码修改成功！');
    		}else{
    			//echo $userTab->getLastsql();die();
    			$this->error('修改失败重新再试！');
    		}
    	}
  }

  //修改 领用状态  未完成
  public function upReceive($uid)
  {
      
      

  }

  /**
   * 修改上报状态
   */
  public function upReport($uid)
  {
    $where['uid'] = $uid;
    $date['is_report'] = date('Ym');
    $this->dbTable->where($where)->setField($date);
    
  }

 /**
   * 查看 上报状态
   * return $arr 没有上报的uid name
   */
  public function getNoreport()
  { 
    $where['status'] = 1;
    $where['role']   = 0;
    $where['is_report'] = array('NEQ',date('Ym'));
    
    $userRes = $this->dbTable->where($where)->field('uid,branchname')->select();
    if ($userRes) {
      return $userRes;
    }else{
      return false;
    }
  }
}